<template>
	<view class="wrap">
		<view class="input">
			<input v-model="username" type="text" placeholder="请输入制单人姓名" placeholder-class="phc">
		</view>
		<view class="btn">
			<g-btn @click="onConfirmTap"></g-btn>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: ''
			}
		},
		onLoad(options) {

		},
		methods: {
			async onConfirmTap() {
				try {
					if (!this.username) {
						uni.showToast({
							title: '请输入制单人姓名',
							icon: 'none'
						})
						return
					}
					await this.$g_api.saleslipSaveAuthor({
						name: this.username
					})
					uni.$emit('update-docMakerList')
					uni.navigateBack()
				} catch (e) {
					//TODO handle the exception
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.input {
		display: flex;
		padding: 0 30rpx;
		height: 110rpx;
		background-color: #fff;

		input {
			flex: 1;
			height: 110rpx;
		}
	}

	::v-deep .phc {
		color: #ccc;
	}

	.btn {
		margin-top: 100rpx;
	}
</style>
